package com.uton.rfidcontroller.viewmodel.activity_model;

import android.databinding.ObservableField;

import com.uton.rfidcontroller.common.interfaces.INetController;
import com.uton.rfidcontroller.common.net.RetrofitFactory;
import com.uton.rfidcontroller.common.utils.Utils;
import com.uton.rfidcontroller.model.DetailsModel;
import com.uton.rfidcontroller.viewmodel.base.BaseViewModel;

import java.util.HashMap;

/**
 * Created by 王家宝 on 2017/8/30.
 * Email:639586819@qq.com
 * Tel:18241150668
 */

public abstract class TestViewModel extends BaseViewModel {

    public final ObservableField<DetailsModel> detailsInfo = new ObservableField<>();

    private void queryDetailsInfo() {
        HashMap<String, String> tempMap = new HashMap<>();
        tempMap.put("indentId", "8e5c78489d824e658130b4d8450e331f");
        go(RetrofitFactory.getInstance().queryDetails(tempMap), new INetController<DetailsModel>() {
                    @Override
                    public void onSuccess(DetailsModel response) {
                        detailsInfo.set(response);
                    }

                    @Override
                    public void onError() {
                    }

                    @Override
                    public void onComplete() {

                    }
                }
        );

    }

    public void refresh(){
        Utils.showShortToast("点击");

    }


    @Override
    public void refreshData() {
        queryDetailsInfo();
    }
}
